package com.hnas.ecard.domain;

import java.util.HashMap;
import java.util.Map;

/**
 * 购卡支付方式枚举类
 * <p>Title:SaleCardPayTypeEnum </p>
 * <p>Description:</p>
 * <p>Componay:</p>
 * @author zhd.yu
 * @date 2018-02-27 11:52:02
 */
public enum CommoditOrderStatus {

	COMMODIT_ORDER_INIT(0,"初始化"),COMMODIT_ORDER_UNUSE(1,"未核销"),COMMODIT_ORDER_USED(2,"已核销"),COMMODIT_ORDER_CANCEL(3,"已撤销");
	
	private int type;
	private String description;
	
	private static Map<Integer,CommoditOrderStatus> map = new HashMap<Integer,CommoditOrderStatus>();
	
	static {
		for(CommoditOrderStatus o : CommoditOrderStatus.values()){
			map.put(o.type, o);
		}
	}
	
	private CommoditOrderStatus(int type, String description) {
		this.type = type;
		this.description = description;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	
	
	public static String getDescByType(int type) {
		if(map.containsKey(type)) {
			return map.get(type).getDescription();
		}
		return null;
	}
	
	public static Map<Integer,CommoditOrderStatus> getMap(){
		return map;
	}

}
